package com.doge.walknovel.business.reader.viewholders

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.doge.wnpro.R
import com.doge.walknovel.api.model.NovelDetailInfo
import com.doge.walknovel.core.base.adapters.AdapterCallback
import com.doge.wnpro.databinding.CellNovelCoverBinding
import com.doge.walknovel.utils.dp
import com.doge.walknovel.utils.load

class NovelCoverViewHolder(
    parent: ViewGroup,
    callback: AdapterCallback,
    private val binding: CellNovelCoverBinding = CellNovelCoverBinding.inflate(
        LayoutInflater.from(parent.context), parent, false),
) : RecyclerView.ViewHolder(binding.root) {
    init {
    }

    fun bind(item: NovelDetailInfo) {
        itemView.tag = item

        binding.cover.load(item.coverUrl, R.drawable.shape_f7f7f7, width = 120.dp, height = 170.dp)
        binding.title.text = item.title
        binding.author.text = item.author
    }
}